<?php
/**
 *Data Base Link
 *
 *Class for manager the Link, is extends of DBClass
 *
 *@author Alberto Berroteran <ashrey10@yahoo.es>
 *@version 0.2 Beta
 *@copyright Copyrigth (c)2008 Alberto Berroteran
 */
final class Link extends ARecord{
	function add(){
		$o_db  = new dbARecord($this->o_connect);
		$o_db->tables('link')->cols('text', 'href');
		return $o_db->insert();
	}

	function edit($i_id){
		$o_db  = new dbARecord($this->o_connect);
		$o_db->tables('link')->cols('text', 'href');
		return $o_db->update('id_link', $i_id);
	}

	function delete($i_id){
		$o_db  = new dbARecord($this->o_connect);
		$o_db->tables('link')->limit(1);
		return $o_db->delete('id_link', $i_id);
	}

	function toindex(){
		$this->tables('link')->cols('id_link', 'text', 'href');
		return $this->select();
	}
	
	function getById($i_id){
		$o_db  = new dbARecord($this->o_connect);
		$o_db->tables('link')->cols('id_link', 'href', 'text')->where('id_link = %u', $i_id);
		return $o_db->select_one();
	}
}//end of class dblink
?>
